const App = getApp();

Component({
    data: {
        cartnum: App.globalData.cartnum,
        selected: 0,
        color: "#7A7E83",
        selectedColor: "#3cc51f",
        // list: [{
        //   pagePath: "/index/index",
        //   iconPath: "/image/icon_component.png",
        //   selectedIconPath: "/image/icon_component_HL.png",
        //   text: "组件"
        // }, {
        //   pagePath: "/index/index2",
        //   iconPath: "/image/icon_API.png",
        //   selectedIconPath: "/image/icon_API_HL.png",
        //   text: "接口"
        //         }],
        list: [
            {
                "iconPath": "/images/home.png",
                "pagePath": "/pages/home/home",
                "text": "首页",
                "selectedIconPath": "/images/home-on.png"
            },
            {
                "iconPath": "/images/classification.png",
                "pagePath": "/pages/home/classify",
                "text": "快速选品",
                "selectedIconPath": "/images/classification-on.png"
            },
            {
                "iconPath": "/images/health.png",
                "pagePath": "/pages/health/health",
                "text": "健康",
                "selectedIconPath": "/images/health-on.png"
            },
            {
                "iconPath": "/images/shop.png",
                "pagePath": "/pages/home/cart",
                "text": "购物车",
                "selectedIconPath": "/images/shop-on.png"
            },
            {
                "iconPath": "/images/my.png",
                "pagePath": "/pages/home/me",
                "text": "我的",
                "selectedIconPath": "/images/my-on.png"
            }
        ]
    },
    attached() {
        // console.log(App.globalData.cartnum);
        this.setData({
            cartnum: App.globalData.cartnum,
        })
    },
    methods: {
        switchTab(e) {
            const data = e.currentTarget.dataset
            const url = data.path

            wx.switchTab({ url })
            // this.setData({
            //     selected: data.index
            // })
        }
    }
})